<template>
  <view class="page">
    <swiper class="swiper" :indicator-dots="dots" @change="fnChange">
      <swiper-item>
        <!-- <view class="wrap">
          <image src="/static/launch-1.png" mode="aspectFit"></image>
          <view class="text">
            <view>自动监控</view>
            <view>实时行情精准提醒</view>
          </view>
        </view> -->
		<image src="../../static/swiper/yindao1.png" mode="scaleToFill"/>
      </swiper-item>
      <swiper-item>
       <image src="../../static/swiper/yindao2.png" mode="scaleToFill"/>
      </swiper-item>
      <swiper-item>
		  <image src="../../static/swiper/yindao3.png" mode="scaleToFill"/>
        <view class="wrap">
          <view class="text" style="bottom:100rpx">
            <view class="go" @tap="goLogin">开始使用</view>
          </view>
        </view>
      </swiper-item>
    </swiper>
  </view>
</template>

<script>
export default {
  data() {
    return {
      dots: true // 轮播是否显示指示点
    }
  },
  methods: {
    goLogin() {
      // 如果更新后需要重新进到启动页 则把 BY-LAUNCH 设为其他值即可（记得要remove之前的storage）
      // uni.setStorageSync('BY-LAUNCH-2', true)

      // uni.removeStorageSync('BY-LAUNCH-1')

      // const unserInfo = uni.getStorageSync('BY-USER')
      console.log(uni.getStorageSync('Login'))
      if (uni.getStorageSync('Login')) {
      	uni.switchTab({
      		url: '/pages/home/home'
      	})
      } else {
      	uni.navigateTo({
      		url: '/pages/login/login'
      	})
      }
    },
    fnChange(e) {
      // 当轮播到最后一页时 隐藏轮播指示点
      this.dots = e.detail.current !== 2
    }
  }
}
</script>

<style lang="scss">
@include page;
page,
.page {
  @include fill;
}
.swiper {
  height: 100%;
  .wrap {
    @include fill;
    position: relative;
  }
  image {
    position: absolute;
    top: 0;
    left: 0;
    @include fill;
  }
  .text {
    position: absolute;
    bottom: 300rpx;
    width: 100%;
    text-align: center;
    view {
      &:nth-child(1) {
        font-size: 32rpx;
        // font-weight: bold;
        color: #FFFFFF;
        margin-bottom: 37rpx;
      }
      &:nth-child(2) {
        font-size: 34rpx;
        color: #46506e;
      }
    }
  }
  .go {
    @include active;
    // position: absolute;
    // bottom: 240rpx;
    // left: 50%;
    margin-top: 60rpx;
	margin-left: 210rpx;
    // transform: translateX(325rpx);
    // background-image: url('~@/static/launch-icon.png');
    @include background;
    width: 350rpx;
	// border: 1rpx solid red;
	line-height: 80rpx;
    border-radius: 20rpx;
	background-color: #1677FF;
  }
  /deep/ .uni-swiper-dots-horizontal {
    bottom: 90rpx;
    .uni-swiper-dot {
      background-color: #dadadc;
    }
    .uni-swiper-dot-active {
      background-color: #2196F3;
    }
  }
}
</style>
